package com.jftone.bh.app.action;

import com.jftone.bh.app.config.SysConst;
import com.jftone.bh.app.model.NtbBase;
import com.jftone.bh.app.service.PointService;
import com.jftone.bh.app.util.UploadFile;
import org.apache.log4j.Logger;
import org.jftone.annotation.Autowired;
import org.jftone.annotation.Controller;
import org.jftone.exception.ActionException;
import org.jftone.util.DataMap;
import org.jftone.util.DateUtil;
import org.jftone.util.IData;
import org.jftone.util.StringUtil;

import java.util.List;


@Controller(mapping="/pointAction")
public class PointAction extends BaseAction {

	private Logger logger = Logger.getLogger(PointAction.class);
	
	@Autowired
	private PointService service;

	public void query() throws ActionException {
		IData<String, Object> data = getData();
		String type = data.getString("type", "");
		String account = data.getString("account", "");
		String pointNo = data.getString("pointNo", "");
		String userId = data.getString("userId", "");
		String sTime = data.getString("sTime", "");
		String eTime = data.getString("eTime", "");
		this.putRenderInfo("sTime", sTime);
		this.putRenderInfo("eTime", eTime);
		this.putRenderInfo("userId", userId);
		this.putRenderInfo("pointNo", pointNo);
		this.putRenderInfo("type", type);
		this.putRenderInfo("account", account);
		try {
			//设置功能按钮
			setMenuFuncDerictive();
			//设置分页组件
			setPageDerictive();
			putParam("sTime", sTime);
			putParam("eTime", eTime);
			putParam("userId", userId);
			putParam("pointNo", pointNo);
			putParam("type", type);
			putParam("account", account);
			putParam(SysConst.QUERY_PARAMS, getParam());
			List<IData<String, Object>> list = service.queryList(data, getPage());
			this.putRenderInfo("list", list);
			this.render("point/point_list.html");
		} catch (Exception e) {
			logger.error("查询流水列表错误" + e.getMessage(), e);
			throw new ActionException("查询流水列表错误" + e.getMessage(), e);
		}
	}


}
